/**
 * @projectName: java-daily-questions
 * @package: PACKAGE_NAME
 * @className: StringDemo
 * @author: ZM
 * @description: 字符串 - demo
 * @date: 2021/8/16 13:53
 * @version: 1.0
 */
public class StringDemo {

    public static void main(String[] args) {
        String a = "12" + "34";
        String b = "1234";
        System.out.println("a.hashCode() = " + System.identityHashCode(a));
        System.out.println("b.hashCode() = " + System.identityHashCode(b));
        System.out.println("a == b is " + (a == b));

        String c = "12" + new String("34");
        System.out.println("c.hashCode() = " + System.identityHashCode(c));
        System.out.println("b == c is " + (b == c));

        String d = "12";
        String e = d + "34";
        System.out.println("e.hashCode() = " + System.identityHashCode(e));
        System.out.println("b == e is " + (b == e));
    }
}
